#include "DebugLog.h"

// the static instance of the class
DebugLog *DebugLog::_instance = NULL;

// the static method used to access the class instance
// *used to access all class functionality
DebugLog *DebugLog::instance()
{
    if(!_instance)
        _instance = new DebugLog;
    return _instance;
}

DebugLog::DebugLog()
{
    // debug.txt is the file that the error messages get sent to
    _file.open("debug.txt");
    _file.flush();
}

DebugLog::~DebugLog()
{
    _file.close();
}

/** errorMessage is a function that takes infinate parameters ... need to figure it out still **/
/*void DebugLog::errorMessage(const char* msg,...)
{
    char buffer[500];

    var_list args;
    va_start(args, msg);
    vsprintf(buffer, msg, args);
    va_end(args);

    _file << buffer << std::endl;

    _file.flush();
}*/

/*
   writes to the file without ending the line,
   used when you need to output more than one
   variable of data
*/
void DebugLog::write(const char* msg)
{
    _file << " " << msg;
}

//writes to the file and then ends the line
void DebugLog::writeLine(const char* msg)
{
    _file << msg << std::endl;
}


// returns to the next line the param amount times
void DebugLog::endLine(int amount)
{
    for(unsigned int i = 0; i < 0; i++)
    {
        _file << std::endl;
    }
}
